package com.hou.kafka.cosumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.KafkaListener;

@Configuration
public class CosumerConfig {
    /**
     * 定义此消费者接收topics = "test"的消息，与controller中的topic对应上即可
     */
    @KafkaListener(topics = {"test"})
    public void listen (ConsumerRecord<?, ?> record){
        System.out.printf("topic is %s, offset is %d, value is %s \n", record.topic(), record.offset(), record.value());
    }
}
